package com.myapp.mobilesafe.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.myapp.mobilesafe.utils.PrefUtils;

/**
 * 手机防盗界面
 *
 */
public class SafeLocationActivity extends AppCompatActivity {
    private TextView tvBind;
    private TextView tvNumber;
    private ImageView ivLock;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Boolean configed = PrefUtils.getBoolean("configed", false, this);
        if(!configed){
            startActivity(new Intent(this,SetupDirect01Activity.class));
            finish();
        }else {
            setContentView(R.layout.activity_safe_location);
            tvNumber = (TextView) findViewById(R.id.tv_number);
            tvBind = (TextView) findViewById(R.id.tv_bind);
            ivLock = (ImageView) findViewById(R.id.iv_lock);
            Boolean isBind = PrefUtils.getBoolean("protect", false, this);
            String phone = PrefUtils.getString("save_phone","",this);
            if(isBind){
                tvNumber.setText(phone);
                tvBind.setText("已绑定");
                ivLock.setImageResource(R.drawable.lock);
            }else {
                tvNumber.setText(phone);
                tvBind.setText("未绑定");
                ivLock.setImageResource(R.drawable.unlock);
            }
        }
    }
    public void resetup(View view ){
        startActivity(new Intent(this,SetupDirect01Activity.class));
        finish();
    }
}
